// JavaScript Document
 function getStyle(obj,attr)   //getStyle 非行间属性  结果值为 ***px  
    {    if(obj.currentStyle)
        {
            return obj.currentStyle[attr];
        }
        else{
            return getComputedStyle(obj,false)[attr];
        }        
    }   
   　　 //多物体不同运动框架
    function Move(obj,attr,itarget)
    {    
        clearInterval(obj.timer);
        obj.timer=setInterval(function(){
            if(attr=="opacity")
            {    cur=parseFloat(getStyle(obj,attr))*100;
                speed=(itarget-cur)/10;
                speed=speed>0?Math.ceil(speed):Math.floor(speed);    

                if(cur==itarget)
                    {
                    clearInterval(obj.timer);
                    }else
                    {    cur+=speed;
                        obj.style.opacity=cur/100;
                        obj.style.filter="alpha(opacity:"+cur+")";                
                    }                
            }
            else
            {
                cur=parseInt(getStyle(obj,attr));
                speed=(itarget-cur)/10;   //parseInt 获取的值转化为数
                speed=speed>0?Math.ceil(speed):Math.floor(speed);    //向下、向上取正

                if(cur==itarget)
                {
                    clearInterval(obj.timer);
                }else
                {
                    obj.style[attr]=cur+speed+"px";        
                }    
            }    

        },30)    
    }

    function goods_add(){
        var sum=document.getElementById("sum").value;
        document.getElementById("sum").value=parseInt(sum)+1;
    }
    function goods_jian(){
        var sum=document.getElementById("sum").value;
        if(sum>=1){
            document.getElementById("sum").value=parseInt(sum)-1;
        }
        
    }

   
function show1(img,name,price) {

        var guige=$("input[type='radio']:checked").val();
        var peisong=$('option:selected').val();
        var sum=document.getElementById("sum").value;

        price_sum=parseFloat(price)*parseFloat(sum);

        if(!peisong){
           alert('请选择送货地点！');
        }else if(!guige){
            alert('请选择商品规格！');
        }else if(sum<1){
            alert('请选择正确的数量！');
        }else{
            if(peisong.length>8){
                peisong=peisong.substring(0,8)+"...";
            }
            
       　　　　art.dialog({
       　　　　 height: 460,
    　　　　　 width:600,
    　　　　    title:'购物车',
    　　　　　 content:'<form action="/index.php/index/Shop/shopok" id="form1" method="post"><img src="'+img+
                        '"height="150px" width="250px"><div class="gwc">商品名称: <span>'+name+'<input name="name" type="text" style="display:none" value="'+name+'">'+
                        '</span></div><div class="gwc">商品规格: <span>'+guige+'<input name="guige" type="text" style="display:none" value="'+guige+'">'+
                        '</span></div><div class="gwc">商品单价: <span>'+price+'<input name="price" type="text" style="display:none" value="'+price+'">'+
                        '</span></div><div class="gwc">商品数量: <span>'+sum+'<input name="sum" type="text" style="display:none" value="'+sum+'">'+
                        '</span></div><div class="gwc">配送地址: <span>'+peisong+'<input name="peisong" type="text" style="display:none" value="'+peisong+'">'+
                        '</span></div><div class="gwc">商品总价: <span>￥'+price_sum+'<input name="price_sum" type="text" style="display:none" value="'+price_sum+'">'+'</span></div></form>',
               background:'#000',
               lock:true,
               opacity:'0.7',
               button:[{value:"去结算",focus: true, callback: function(){document.getElementById("form1").submit();}}, {value: '返回购物'}]


       　　　　});
            }  

        }
